<template>
    <div>
      <ul>
        <li v-for="(item,index) in arr" :key="index">
          {{item}}
          <button @click="fn(index)">删除</button>
        </li>
        <br>
        <button @click="add()">增加</button>
      </ul>
    </div>
  </template>
  
  <script>
  export default {
  data(){
  return{
    arr:[1,3,4,5,6,7,4,3,2],
    arr2:[6,3,4,4,5,56,6,767,]
  }
  },
  methods:{
  fn(index){
  this.arr.splice(index,1)
  
  },
  add(){
  // this.arr.push(this.arr2)
  // 生成随机数 在push 数组中   Math.floor取整的意思
  this.arr.push(Math.floor(Math.random() * 20));
  }
  }
  }
  </script>
  
  <style>
  
  </style>